/*
 * PixelsSum.cpp
 * Created on: 04/04/2011
 * Author: catharine
 */

#include "PixelsSum.h"

PixelsSum::PixelsSum() {
}

PixelsSum::~PixelsSum() {
}

/*
 * Find the number of pixels related to a specific color.
 * @param The image where pixels will be counted.
 * @param colorValue The value that refers the the color.
 */
double PixelsSum::findNumberPixels(IplImage* image, int colorValue) {
	double sum = 0;
	for (int i = 0; i < image->height; i++) {
		for (int j = 0; j < image->width; j++) {
			if (cvGetReal2D(image, i, j) == colorValue) {
				sum++;
			}
		}
	}
	return sum;
}
